#include <iostream>

class Test
{
    pulic;
    Test()
    {
        std::cout<<"构造函数"<<std::endl;
    }
    ~Test()
    {
        std::cout<<"析构函数"<<std::endl;
    }
    void show()
    {
        std::cout<<"helloworld\n";
    }
};

//RAII
class SmartPoint
{
    public:
    SmartPoint(Test *t):t(t){}  //内存托管
    ~SmartPoint()
    {
        delete t;
    }
    Test* operator->()
    {
        return t;
    }
    Test& operato*()
    {
        return *t;
    }

private:
    Test *t;
};

int main()
{
    SmartPoint p(new Test);
    p->show();

    Test t=*P;
    return 0;
}